package com.hspedu.collection_;
/*
 *@auther will
 *@version 1.0
 */

import java.util.ArrayList;
import java.util.Collection;

public class CollectionFor {
    public static void main(String[] args) {

        Collection col =new ArrayList();

        col.add(new Book("三国演义","罗贯中",10.1));
        col.add(new Book("小李飞刀","古龙",5.1));
        col.add(new Book("红楼梦","曹雪芹",34.6));

        //使用增强for循环
        for(Object book:col){
            System.out.println(book);
        }

        //增强for循环可以在数组中使用
        int[] nums = {1,4,5,6};
        for(int i:nums){
            System.out.println(i);
        }



    }
}
